package org.shock.ss.sms.service.system.impl;

import org.shock.ss.sms.bean.system.Module;
import org.shock.ss.sms.commons.db.ProxoolDbPool;

import org.shock.ss.sms.commons.dao.BaseDao;
import org.shock.ss.sms.commons.service.impl.BaseServiceImpl;
import org.shock.ss.sms.service.system.ModuleService;

public class ModuleServiceImpl extends BaseServiceImpl implements ModuleService {

	public ModuleServiceImpl(BaseDao dao) {
		super(dao);
	}

	@Override
	public void add(Object bean) throws Exception {
		try {
			tx = ProxoolDbPool.getTranManager();
			tx.beginTransaction();
			dao.add(bean);
			Module module = new Module();
			module.setId(((Module) bean).getPid());
			module.setLeaf(false);
			dao.update(module);
			tx.commitAndClose();
		} catch (Exception e) {
			tx.rollbackAndClose();
			throw e;
		}
	}

}
